﻿@model Property4U.Models.HomeViewModels

@{
    Layout = "~/Views/Shared/_PublicLayout.cshtml";
}

@{
    IdentitySample.Models.ApplicationDbContext dbo = new IdentitySample.Models.ApplicationDbContext();
    Property4U.Models.Configuration Settings = null;
    if (dbo.Database.Exists())
    {
        try
        {
            //Settings = Property4U.Core.ConfigSys.GetSysInfo()/*.Result*/;
            Settings = Property4U.Core.ConfigSys.Settings;
        }
        catch (Exception)
        {
            System.Diagnostics.Debug.WriteLine("Configuration - Error");
        }
    }
    bool allow = (Settings == null) ? false : true;
}

@{
    ViewBag.Title = "Home";
}

@helper DisplayNameSys(System.Reflection.FieldInfo myfield)
{
    dynamic field = myfield;

    if (field != null)
    {
        var display = ((System.ComponentModel.DataAnnotations.DisplayAttribute[])field.GetCustomAttributes(typeof(System.ComponentModel.DataAnnotations.DisplayAttribute), false)).FirstOrDefault();
        if (display != null)
        {
            @display.Name
        }
    }
}

@*<div class="row">
        <!-- Page Header -->
        <div class="col-lg-12">
            <h1 class="page-header">@ViewBag.Title</h1>
            <table>
                <tr>
                    <th>
                        DeviceType
                    </th>
                    <th>
                        Qt
                    </th>
                </tr>
                @if (Model != null)
                {
                    foreach (var item in Model.Types)
                    {
                        <tr>
                            <td>
                                @Html.DisplayFor(modelItem => item.Type)
                            </td>
                            <td>
                                @Html.DisplayFor(modelItem => item.Count)
                            </td>
                        </tr>
                    }
                }
                </table>
    </div>
        <!--End Page Header -->
    </div>*@
    @if (@Model.FeaturePropertyPhoto != null && @Model.FeaturePropertyPhoto.Count() != 0)
    {
    <section id="slider" class="@Settings.ThemeColor">
        <!--slider-->
        <div class="container">
            <div class="row">
                <div class="col-sm-12">
                    <div id="slider-carousel" class="carousel slide" data-ride="carousel">

                        <ol class="carousel-indicators">
                            @for(int featItems = 0; featItems < @Model.FeaturePropertyPhoto.Count(); featItems++){
                                if(featItems == 0){
                                    <li data-target="#slider-carousel" data-slide-to="@featItems" class="active"></li>
                                }else{
                                    <li data-target="#slider-carousel" data-slide-to="@featItems"></li>
                                }
                            }
                        </ol>

                        <div class="carousel-inner">
                        @{var featItemCount = 0;}
                        @foreach (var item in @Model.FeaturePropertyPhoto)
                        {
                            string classActive = (featItemCount == 0) ? "active" : null;
                            <div class="item @classActive">
                                <div class="col-sm-8">
                                    <h3><span>@item.Property.Title.Substring(0, 1)</span>@item.Property.Title.Substring(1)</h3>
                                    <h2 class="pro-price">@Html.DisplayFor(modelItem => item.Property.Price)</h2>
                                    <div class="core-features clearfix">
                                        <span class="area"><strong>@item.Property.AreaMeasurement</strong>Area</span>
                                        @if (!item.Property.OfType.Title.Equals("Land"))
                                        {
                                            <span class="baths"><strong>@item.Property.Baths</strong>Baths</span>
                                            <span class="beds"><strong>@item.Property.NumberOfRooms</strong>Beds</span>
                                            <span class="parking"><strong>@item.Property.CarSpaces</strong>Parking</span>
                                        }
                                    </div>
                                    <p>For: @Html.DisplayFor(modelItem => item.Property.For)</p>
                                    <p>Type: @Html.DisplayFor(modelItem => item.Property.OfType.Title)</p>
                                    <div class="row"><div class="col-md-12"><span class="pull-right"><a href="@Url.Action("Details", "FrontEnd", new { PID = @item.Property.ID })" class="btn btn-default add-to-cart hire-agent"><i class="fa fa-user"></i>Hire Agent</a></span></div></div>

                                </div>
                                <div class="col-sm-4">
                                    @if (item.Photo != null)
                                    {
                                        <img src="~/Content/Uploads/Properties/Medium/@item.Photo.PhotoTitle" alt="@item.Photo.PhotoTitle" />
                                    }
                                    else
                                    {
                                        <img src="~/Content/Uploads/Properties/Medium/no-photo.jpg" title="@Html.DisplayFor(modelItem => item.Property.Title)" alt="@Html.DisplayFor(modelItem => item.Property.Title)" />
                                    }
                                    @*<img src="~/Content/images/home/pricing.png" class="pricing" alt="" />*@
                                </div>
                            </div>
                                    featItemCount++;
                        }
                        </div>

                        <a href="#slider-carousel" class="left control-carousel hidden-xs" data-slide="prev">
                            <i class="fa fa-angle-left"></i>
                        </a>
                        <a href="#slider-carousel" class="right control-carousel hidden-xs" data-slide="next">
                            <i class="fa fa-angle-right"></i>
                        </a>
                    </div>

                </div>
            </div>
        </div>
    </section><!--/slider-->
    }

    <section class="@Settings.ThemeColor">
    <div class="container">
        <div class="row">
            <div class="col-sm-3">
                <div class="left-sidebar @Settings.ThemeColor">
                    <h2>Category</h2>
                    <div class="panel-group category-products" id="accordian">
                        <!--category-productsr-->
                        @foreach (var items in Model.TypeSubTypes)
                        {
                            <div class="panel panel-default">
                                <div class="panel-heading">
                                    <h4 class="panel-title">
                                        @if (items.SubTypes != null)
                                        {
                                            <a data-toggle="collapse" data-parent="#accordian" href="#@items.Type.Title">
                                                <span class="badge pull-right"><i class="fa fa-plus"></i></span>
                                                @items.Type.Title
                                            </a>
                                        }
                                        else
                                        {
                                            <a href="@Url.Action("Properties", new { filterType = items.Type.Title })">@items.Type.Title</a>
                                        }
                                    </h4>
                                </div>

                                @if (items.SubTypes != null)
                                {
                                    <div id="@items.Type.Title" class="panel-collapse collapse">
                                        <div class="panel-body">
                                            <ul>
                                                @foreach (var subItems in items.SubTypes)
                                                {
                                                    <li><a href="@Url.Action("Properties", new { filterType = items.Type.Title, filterSuType = subItems.Title})">@subItems.Title</a></li>
                                                }
                                            </ul>
                                        </div>
                                    </div>
                                }

                            </div>
                        }
                    </div><!--/category-products-->

                    <div class="brands_products">
                        <!--brands_products-->
                        <h2>For</h2>
                        <div class="brands-name">
                            <ul class="nav nav-pills nav-stacked">
                                @foreach (var item in Model.For)
                                {
                                    <li><a href="@Url.Action("Properties", new { filterFor = item.Title })"> <span class="pull-right">(@item.Count)</span>@item.Title</a></li>
                                }
                            </ul>
                        </div>
                    </div><!--/brands_products-->

                    <div class="brands_products">
                        <!--brands_products-->
                        <h2>Bidding</h2>
                        <div class="brands-name">
                            <ul class="nav nav-pills nav-stacked">
                                @foreach (var item in Model.Biddings)
                                {
                                    <li><a href="@Url.Action("Properties", new { filterBidding = item.Status })"> <span class="pull-right">(@item.Count)</span>@item.Status</a></li>
                                }
                            </ul>
                        </div>
                    </div><!--/brands_products-->

                    <div class="price-range">
                        <!--price-range-->
                        <h2>Price Range</h2>
                        <div class="well text-center">
                            <input type="text" class="span2" value="" data-slider-min="5" data-slider-max="500000" data-slider-step="5" data-slider-value="[250,450]" id="sl2"><br />
                            <b class="pull-left">$ 5</b> <b class="pull-right">$ 500000</b>
                        </div>
                    </div><!--/price-range-->

                    <div class="shipping text-center">
                        <!--shipping-->
                        <div id="sidead">
                            <a href="">
                                <img src="" alt="advertisement">
                            </a>
                        </div>
                    </div><!--/shipping-->

                </div>
            </div>

            <div class="col-sm-9 padding-right">
                <div class="features_items">
                    <!--features_items-->
                    <h2 class="title @Settings.ThemeColor text-center">Popular Properties</h2>
                    @foreach (var item in Model.PropertyPhoto)
                    {
                        <div class="col-sm-4" id="ListPID-@item.Property.ID">
                            <div class="product-image-wrapper">
                                <div class="single-products">
                                    <div class="productinfo @Settings.ThemeColor text-center">
                                        <div class="image">
                                            @if (item.Photo != null)
                                            {
                                                <img src="~/Content/Uploads/Properties/Small/@Html.DisplayFor(modelItem => item.Photo.PhotoTitle)" title="@Html.DisplayFor(modelItem => item.Property.Title)" alt="@Html.DisplayFor(modelItem => item.Photo.AltText)" />
                                            }
                                            else
                                            {
                                                <img src="~/Content/Uploads/Properties/Small/no-photo.jpg" title="@Html.DisplayFor(modelItem => item.Property.Title)" alt="@Html.DisplayFor(modelItem => item.Property.Title)" />
                                            }
                                            <div class="promotion">
                                                <span class="loaction"> <i class="fa fa-map-marker"></i> @Html.DisplayFor(modelItem => item.Property.Address.City)</span>
                                                <span class="status na-@item.Property.Status.ToString()">
                                                    @if (item.Property.Status.ToString().Equals("In_Discount"))
                                                    {
                                                        @item.Property.Discount @("% OFF")
                                                    }
                                                    else if (!item.Property.Status.ToString().IsEmpty())
                                                    {
                                                        @DisplayNameSys(item.Property.Status.GetType().GetField(item.Property.Status.ToString()));
                                                    }
                                                </span>
                                            </div>
                                        </div>
                                        <div class="description">
                                            <h2 class="pro-price">@Html.DisplayFor(modelItem => item.Property.Price)</h2>
                                            <p>@Html.DisplayFor(modelItem => item.Property.Title)</p>
                                            <a href="@Url.Action("Details", "FrontEnd", new { PID = @item.Property.ID })" class="btn btn-default add-to-cart hire-agent"><i class="fa fa-user"></i>Hire Agent</a>
                                        </div>
                                    </div>

                                    <div class="core-features clearfix">
                                        <span class="area"><strong>@item.Property.AreaMeasurement</strong>Area</span>
                                        @if (!item.Property.OfType.Title.Equals("Land"))
                                        {
                                            <span class="baths"><strong>@item.Property.Baths</strong>Baths</span>
                                            <span class="beds"><strong>@item.Property.NumberOfRooms</strong>Beds</span>
                                            <span class="parking"><strong>@item.Property.CarSpaces</strong>Parking</span>
                                        }
                                    </div>

                                    <div class="product-overlay @Settings.ThemeColor">
                                        <div class="overlay-content">
                                            <div class="description">
                                                <h2>@Html.DisplayFor(modelItem => item.Property.Price)</h2>
                                                <p>@Html.DisplayFor(modelItem => item.Property.Title)</p>
                                                <a href="@Url.Action("Details", "FrontEnd", new { PID = @item.Property.ID })" class="btn btn-default add-to-cart"><i class="fa fa-user"></i>Hire Agent</a>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                                <div class="@Settings.ThemeColor choose">
                                    <ul class="nav nav-pills nav-justified">
                                        <li><a href="#ListPID-@item.Property.ID" class="addToWishlist" data-pid="@("11"+item.Property.ID)"><i class="fa fa-plus-square"></i>Add to wishlist</a></li>
                                        <li><a href="#ListPID-@item.Property.ID" class="addToComparelist" data-pid="@item.Property.ID"><i class="fa fa-plus-square"></i>Add to compare</a></li>
                                    </ul>
                                </div>
                            </div>
                        </div>
                    }
                    @*<div class="col-sm-4">
                            <div class="product-image-wrapper">
                                <div class="single-products">
                                    <div class="productinfo text-center">
                                        <img src="~/Content/images/home/product2.jpg" alt="" />
                                        <h2>$56</h2>
                                        <p>Easy Polo Black Edition</p>
                                        <a href="#" class="btn btn-default add-to-cart"><i class="fa fa-shopping-cart"></i>Add to cart</a>
                                    </div>
                                    <div class="product-overlay">
                                        <div class="overlay-content">
                                            <h2>$56</h2>
                                            <p>Easy Polo Black Edition</p>
                                            <a href="#" class="btn btn-default add-to-cart"><i class="fa fa-shopping-cart"></i>Add to cart</a>
                                        </div>
                                    </div>
                                </div>
                                <div class="choose">
                                    <ul class="nav nav-pills nav-justified">
                                        <li><a href="#"><i class="fa fa-plus-square"></i>Add to wishlist</a></li>
                                        <li><a href="#"><i class="fa fa-plus-square"></i>Add to compare</a></li>
                                    </ul>
                                </div>
                            </div>
                        </div>
                        <div class="col-sm-4">
                            <div class="product-image-wrapper">
                                <div class="single-products">
                                    <div class="productinfo text-center">
                                        <img src="~/Content/images/home/product3.jpg" alt="" />
                                        <h2>$56</h2>
                                        <p>Easy Polo Black Edition</p>
                                        <a href="#" class="btn btn-default add-to-cart"><i class="fa fa-shopping-cart"></i>Add to cart</a>
                                    </div>
                                    <div class="product-overlay">
                                        <div class="overlay-content">
                                            <h2>$56</h2>
                                            <p>Easy Polo Black Edition</p>
                                            <a href="#" class="btn btn-default add-to-cart"><i class="fa fa-shopping-cart"></i>Add to cart</a>
                                        </div>
                                    </div>
                                </div>
                                <div class="choose">
                                    <ul class="nav nav-pills nav-justified">
                                        <li><a href="#"><i class="fa fa-plus-square"></i>Add to wishlist</a></li>
                                        <li><a href="#"><i class="fa fa-plus-square"></i>Add to compare</a></li>
                                    </ul>
                                </div>
                            </div>
                        </div>
                        <div class="col-sm-4">
                            <div class="product-image-wrapper">
                                <div class="single-products">
                                    <div class="productinfo text-center">
                                        <img src="~/Content/images/home/product4.jpg" alt="" />
                                        <h2>$56</h2>
                                        <p>Easy Polo Black Edition</p>
                                        <a href="#" class="btn btn-default add-to-cart"><i class="fa fa-shopping-cart"></i>Add to cart</a>
                                    </div>
                                    <div class="product-overlay">
                                        <div class="overlay-content">
                                            <h2>$56</h2>
                                            <p>Easy Polo Black Edition</p>
                                            <a href="#" class="btn btn-default add-to-cart"><i class="fa fa-shopping-cart"></i>Add to cart</a>
                                        </div>
                                    </div>
                                    <img src="~/Content/images/home/new.png" class="new" alt="" />
                                </div>
                                <div class="choose">
                                    <ul class="nav nav-pills nav-justified">
                                        <li><a href="#"><i class="fa fa-plus-square"></i>Add to wishlist</a></li>
                                        <li><a href="#"><i class="fa fa-plus-square"></i>Add to compare</a></li>
                                    </ul>
                                </div>
                            </div>
                        </div>
                        <div class="col-sm-4">
                            <div class="product-image-wrapper">
                                <div class="single-products">
                                    <div class="productinfo text-center">
                                        <img src="~/Content/images/home/product5.jpg" alt="" />
                                        <h2>$56</h2>
                                        <p>Easy Polo Black Edition</p>
                                        <a href="#" class="btn btn-default add-to-cart"><i class="fa fa-shopping-cart"></i>Add to cart</a>
                                    </div>
                                    <div class="product-overlay">
                                        <div class="overlay-content">
                                            <h2>$56</h2>
                                            <p>Easy Polo Black Edition</p>
                                            <a href="#" class="btn btn-default add-to-cart"><i class="fa fa-shopping-cart"></i>Add to cart</a>
                                        </div>
                                    </div>
                                    <img src="~/Content/images/home/sale.png" class="new" alt="" />
                                </div>
                                <div class="choose">
                                    <ul class="nav nav-pills nav-justified">
                                        <li><a href="#"><i class="fa fa-plus-square"></i>Add to wishlist</a></li>
                                        <li><a href="#"><i class="fa fa-plus-square"></i>Add to compare</a></li>
                                    </ul>
                                </div>
                            </div>
                        </div>
                        <div class="col-sm-4">
                            <div class="product-image-wrapper">
                                <div class="single-products">
                                    <div class="productinfo text-center">
                                        <img src="~/Content/images/home/product6.jpg" alt="" />
                                        <h2>$56</h2>
                                        <p>Easy Polo Black Edition</p>
                                        <a href="#" class="btn btn-default add-to-cart"><i class="fa fa-shopping-cart"></i>Add to cart</a>
                                    </div>
                                    <div class="product-overlay">
                                        <div class="overlay-content">
                                            <h2>$56</h2>
                                            <p>Easy Polo Black Edition</p>
                                            <a href="#" class="btn btn-default add-to-cart"><i class="fa fa-shopping-cart"></i>Add to cart</a>
                                        </div>
                                    </div>
                                </div>
                                <div class="choose">
                                    <ul class="nav nav-pills nav-justified">
                                        <li><a href="#"><i class="fa fa-plus-square"></i>Add to wishlist</a></li>
                                        <li><a href="#"><i class="fa fa-plus-square"></i>Add to compare</a></li>
                                    </ul>
                                </div>
                            </div>
                        </div>*@

                </div><!--features_items-->

                <div class="category-tab @Settings.ThemeColor">
                    <!--category-tab-->
                    <div class="col-sm-12">
                        <ul class="nav nav-tabs">
                            <li><a href="#recent" data-toggle="tab">Recent</a></li>
                            <li class="active"><a href="#biddings" data-toggle="tab">Biddings</a></li>

                        </ul>
                    </div>
                    <div class="col-sm-12 tab-content">
                        <div class="tab-pane fade" id="recent">
                            @foreach (var item in Model.RecentPropertyPhoto)
                            {
                                <div class="col-sm-3">
                                    <div class="product-image-wrapper">
                                        <div class="single-products">
                                            <div class="productinfo @Settings.ThemeColor text-center">
                                                @if (item.Photo != null)
                                                {
                                                    <img src="~/Content/Uploads/Properties/Small/@Html.DisplayFor(modelItem => item.Photo.PhotoTitle)" title="@Html.DisplayFor(modelItem => item.Property.Title)" alt="@Html.DisplayFor(modelItem => item.Photo.AltText)" />
                                                }
                                                else
                                                {
                                                    <img src="~/Content/Uploads/Properties/Small/no-photo.jpg" title="@Html.DisplayFor(modelItem => item.Property.Title)" alt="@Html.DisplayFor(modelItem => item.Property.Title)" />
                                                }
                                                <h2>@Html.DisplayFor(modelItem => item.Property.Price)</h2>
                                                <p>@Html.DisplayFor(modelItem => item.Property.Title)</p>
                                                <a href="@Url.Action("Details", "FrontEnd", new { PID = @item.Property.ID })" class="btn btn-default add-to-cart"><i class="fa fa-user"></i>Hire Agent</a>
                                            </div>

                                        </div>
                                    </div>
                                </div>
                            }
                        </div>

                        <div class="tab-pane fade active in" id="biddings">
                            @foreach (var item in Model.BiddingPropertyPhoto)
                            {
                                <div class="col-sm-3">
                                    <div class="product-image-wrapper">
                                        <div class="single-products">
                                            <div class="productinfo @Settings.ThemeColor text-center">
                                                @if (item.Photo != null)
                                                {
                                                    <img src="~/Content/Uploads/Properties/Small/@Html.DisplayFor(modelItem => item.Photo.PhotoTitle)" title="@Html.DisplayFor(modelItem => item.Property.Title)" alt="@Html.DisplayFor(modelItem => item.Photo.AltText)" />
                                                }
                                                else
                                                {
                                                    <img src="~/Content/Uploads/Properties/Small/no-photo.jpg" title="@Html.DisplayFor(modelItem => item.Property.Title)" alt="@Html.DisplayFor(modelItem => item.Property.Title)" />
                                                }
                                                <h2>@Html.DisplayFor(modelItem => item.Property.Price)</h2>
                                                <p>@Html.DisplayFor(modelItem => item.Property.Title)</p>
                                                <a href="@Url.Action("PlaceBid", "FrontEnd", new { BID = @item.Bidding.ID })" class="btn btn-default add-to-cart"><i class="fa fa-bullhorn"></i>Place Bid</a>
                                            </div>

                                        </div>
                                    </div>
                                </div>
                            }
                        </div>
                    </div><!--/category-tab-->
                    @*<div class="col-sm-12 recommended_items">
                            <!--recommended_items-->
                            <h2 class="title text-center">recommended items</h2>

                            <div id="recommended-item-carousel" class="carousel slide" data-ride="carousel">
                                <div class="carousel-inner">
                                    <div class="item active">
                                        <div class="col-sm-4">
                                            <div class="product-image-wrapper">
                                                <div class="single-products">
                                                    <div class="productinfo text-center">
                                                        <img src="~/Content/images/home/recommend1.jpg" alt="" />
                                                        <h2>$56</h2>
                                                        <p>Easy Polo Black Edition</p>
                                                        <a href="#" class="btn btn-default add-to-cart"><i class="fa fa-shopping-cart"></i>Add to cart</a>
                                                    </div>

                                                </div>
                                            </div>
                                        </div>
                                        <div class="col-sm-4">
                                            <div class="product-image-wrapper">
                                                <div class="single-products">
                                                    <div class="productinfo text-center">
                                                        <img src="~/Content/images/home/recommend2.jpg" alt="" />
                                                        <h2>$56</h2>
                                                        <p>Easy Polo Black Edition</p>
                                                        <a href="#" class="btn btn-default add-to-cart"><i class="fa fa-shopping-cart"></i>Add to cart</a>
                                                    </div>

                                                </div>
                                            </div>
                                        </div>
                                        <div class="col-sm-4">
                                            <div class="product-image-wrapper">
                                                <div class="single-products">
                                                    <div class="productinfo text-center">
                                                        <img src="~/Content/images/home/recommend3.jpg" alt="" />
                                                        <h2>$56</h2>
                                                        <p>Easy Polo Black Edition</p>
                                                        <a href="#" class="btn btn-default add-to-cart"><i class="fa fa-shopping-cart"></i>Add to cart</a>
                                                    </div>

                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="item">
                                        <div class="col-sm-4">
                                            <div class="product-image-wrapper">
                                                <div class="single-products">
                                                    <div class="productinfo text-center">
                                                        <img src="~/Content/images/home/recommend1.jpg" alt="" />
                                                        <h2>$56</h2>
                                                        <p>Easy Polo Black Edition</p>
                                                        <a href="#" class="btn btn-default add-to-cart"><i class="fa fa-shopping-cart"></i>Add to cart</a>
                                                    </div>

                                                </div>
                                            </div>
                                        </div>
                                        <div class="col-sm-4">
                                            <div class="product-image-wrapper">
                                                <div class="single-products">
                                                    <div class="productinfo text-center">
                                                        <img src="~/Content/images/home/recommend2.jpg" alt="" />
                                                        <h2>$56</h2>
                                                        <p>Easy Polo Black Edition</p>
                                                        <a href="#" class="btn btn-default add-to-cart"><i class="fa fa-shopping-cart"></i>Add to cart</a>
                                                    </div>

                                                </div>
                                            </div>
                                        </div>
                                        <div class="col-sm-4">
                                            <div class="product-image-wrapper">
                                                <div class="single-products">
                                                    <div class="productinfo text-center">
                                                        <img src="~/Content/images/home/recommend3.jpg" alt="" />
                                                        <h2>$56</h2>
                                                        <p>Easy Polo Black Edition</p>
                                                        <a href="#" class="btn btn-default add-to-cart"><i class="fa fa-shopping-cart"></i>Add to cart</a>
                                                    </div>

                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                                <a class="left recommended-item-control" href="#recommended-item-carousel" data-slide="prev">
                                    <i class="fa fa-angle-left"></i>
                                </a>
                                <a class="right recommended-item-control" href="#recommended-item-carousel" data-slide="next">
                                    <i class="fa fa-angle-right"></i>
                                </a>
                            </div>
                        </div><!--/recommended_items-->*@

                </div>
            </div>
        </div>
    </div>
</section>



@section scripts{
<script type="text/javascript" src="~/Scripts/AdsScriptSideBar.js"></script>
<script type="text/javascript">
    $(document).ready(function () {
        // Constantly Update value of the Price Range Slider on Start and Stop
        var originalVal;

        // Setting User Selected Range to Slider
        var rangeArray = [@ViewBag.CurrentRangeMi, @ViewBag.CurrentRangeMx];
        if (rangeArray[0] != null && rangeArray[1] != null) {
        $('.span2').data('slider').setValue(rangeArray);
        originalVal = rangeArray;
        }

        // Getting User Selected Range to Slider on Start
        $('.span2').slider().on('slideStart', function (ev) {
        originalVal = $('.span2').data('slider').getValue();
        });

        // Getting User Selected Range to Slider on Stop
        $('.span2').slider().on('slideStop', function (ev) {
        var newVal = $('.span2').data('slider').getValue();
            if (originalVal != newVal) {
                ev.preventDefault();
                window.location.replace =
                '@Url.Action("Properties", "FrontEnd")' + '?filterRangeMi=' + newVal[0] + '&filterRangeMx=' + newVal[1];
            }
        });

    });
</script>
}